@using Microsoft.AspNetCore.Html;
@{
	IList<IDocument> fields = Model.List<IDocument>("Members")
		?.Where(x => x.Bool("IsResult") && x.String("Kind") == "Field")
		.OrderBy(x => x["DisplayName"])
		.ToList();
	if(fields.Count > 0)
	{
		<text>
			<h1 id="fields">Fields</h1>
			<div class="box">
				<div class="box-body no-padding table-responsive">
					<table class="table table-striped table-hover three-cols">
						<thead>
							<tr>
								<th>Name</th>
								<th>Constant Value</th>
								<th>Summary</th>
							</tr>
						</thead>
						@foreach(IDocument field in fields)
						{
							<tr>
								<td>@Context.GetTypeLink(field, false)</td>
								<td>@(field.Bool(CodeAnalysisKeys.HasConstantValue) ? new HtmlString(field.Get(CodeAnalysisKeys.ConstantValue)?.ToString() ?? "null") : new HtmlString(string.Empty))</td>
								<td>
									<div>@Html.Raw(field["Summary"])</div>
									@{
										IDocument containingType = field.Document(CodeAnalysisKeys.ContainingType);
										if(containingType != Model)
										{
											<div><small><em>Inherited from @Context.GetTypeLink(containingType)</em></small></div>
										}
										if(field.Bool(CodeAnalysisKeys.IsStatic))
										{
											<div><small><em>static</em></small></div>
										}
									}
								</td>
							</tr>
						}
					</table>
				</div>
			</div>
		</text>
	}
}